package com.kun.spring.config;

import com.kun.spring.bean.Cat;
import com.kun.spring.bean.Person;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.*;
import org.springframework.core.type.AnnotationMetadata;
import sun.jvm.hotspot.oops.Metadata;

/**
 * @Classname MainConfig
 * @Created by FangKun
 * @Date 2022/11/14 0014 下午 21:36
 */
//@Import({MainConfig.MyImportRegistrar.class})
@ComponentScan("com.kun.spring")
@Configuration
public class MainConfig {

	public MainConfig(){
		System.out.println("MainConfig....创建了.....");
	}

	/*@Bean
	public Person person(){
		Person person = new Person();
		person.setName("坤坤");
		return person;
	}*/

	/*static class MyImportRegistrar implements ImportBeanDefinitionRegistrar{

		//Bean定义信息注册中心,里边放的都是Bean定义BeanDefinition
		@Override
		public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
											BeanDefinitionRegistry registry) {

			RootBeanDefinition definition = new RootBeanDefinition();
			definition.setBeanClass(Cat.class);
			registry.registerBeanDefinition("MyCat",definition);
		}
	}*/


}
